#!/bin/bash
wd=$(dirname $0)

srcf=$(${wd}/gputils.sh)/libgputils/gpprocessor.c
if [ -f ${srcf} ]
then
 arch=$(echo $1 | tr '[a-z]' '[A-Z]')
 if [ -n "${arch}" ]
 then

  if [ -n "$(${wd}/arch.sh ${arch} )" ]
  then

   echo ${arch}

  else

   egrep "_${arch}," ${srcf} | awk -F, '{print $4}' | sed 's% *%%g; s%"%%g; s%_%%g' | tr '[a-z]' '[A-Z]'

  fi
 else
  cat<<EOF>&2
Usage

  $0 <arch>

Description

  List processors by aino.lib target basename, for <arch> e.g. 'pic14'.
  Use <arch> + E for enhanced architectures, e.g. 'pic14e'.

EOF
  exit 1
 fi
else
 cat<<EOF>&2
Error, Missing source '${srcf}'.
EOF
 exit 1
fi
